package com.ncepu.clubmanagement.mapper;

import com.ncepu.clubmanagement.pojo.ClubSelection;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClubSelectionMapper {


    @Select("select person_id from club_selection where club_id = #{clubId}")
    List<Integer> getPersonIdByClubId(Integer clubId);

    @Insert("insert into club_selection (club_id, person_id) values(#{clubId}, #{personId})")
    void addClubSelection(ClubSelection clubSelection);

    @Delete("delete from club_selection where club_id = #{clubId} and person_id = #{personId}")
    void deleteClubSelection(ClubSelection clubSelection);

    @Delete("delete from club_selection where club_id = #{clubId}")
    void deleteClubSelectionByClubId(Integer clubId);
}
